package com.tz.action;

import com.opensymphony.xwork2.ActionSupport;
import com.tz.entity.Group;
import com.tz.service.IGroupService;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * Created by Administrator on 2016/8/5.
 */
@Namespace("/user")
@ParentPackage("json-default")
public class GroupAction extends ActionSupport{

    private List<Group> result;

    @Autowired
    private IGroupService groupService;

    @Action(value = "group",results = {
            @Result(type = "json",params = {"root","result"})
    })
    public String getGroup(){
        result = groupService.findAllGroup();
        return SUCCESS;
    }

    public List<Group> getResult() {
        return result;
    }

    public void setResult(List<Group> result) {
        this.result = result;
    }
}
